<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags" %>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<script type="text/javascript" src="<%= request.getContextPath() %>/js/jquery-ui.min.js"></script>
	<script type="text/javascript" src="<%= request.getContextPath() %>/js/ui.datepicker-vi.js"></script>
	<link href="<%= request.getContextPath() %>/css/jquery-ui.css" rel="stylesheet" type="text/css"/>
	<script>
		$(function() {
		 	$("#date").datepicker();
	  	});
		
		function validateForm() {
			if ($("#name").val() == "") {
				alert("Vui lòng nhập tên");
				$("#name").focus();
				return false;
			}
			if ($("#age").val() == "") {
				alert("Vui lòng nhập tuổi");
				$("#age").focus();
				return false;
			}
			var intRegex = /^\d+$/;
			var age = $("#age").val();
			if (!intRegex.test(age)) {
				alert("Tuổi phải là số");
				$("#age").focus();
				return false;
			}
			if ($("#date").val() == "") {
				alert("Vui lòng chọn ngày khám");
				$("#date").focus();
				return false;
			}
			if ($("#captcha").val() == "") {
				alert("Vui lòng nhập mã số xác nhận");
				$("#captcha").focus();
				return false;
			}
			return true;
		}
 	</script>
</head>
 
<body>
<div class="room boxleft">
	<div class="boxHeader2"><label></label></div>
	<div class="roomContent">
		<img src="<%= request.getContextPath() %>/images/room<s:property value="roomId" />.jpg" /><br/><br/>
		Số thứ tự hiện tại: <span id="currentNum" class="currentNum"><s:property value="curnum" /></span><br/>
		Số thứ tự cuối cùng đã đăng kí: <span id="lastRegisterNum"><s:property value="lastRegisterNum" /></span><br/>
		<a href="booking.action?roomId=<s:property value="roomId" />">Đăng kí theo giờ khám</a><br/>
	</div>
</div>
		
<div class="formContent room boxleft">
<div class="boxHeader2"><label>ĐĂNG KÍ LẤY SỐ THỨ TỰ</label></div>


<div><s:actionerror /></div>

<br/>
<s:form action="registerOrdinal" onsubmit="return validateForm();" method="post" >  
<s:hidden name="roomId"></s:hidden>
<table>
	<tr>
		<td>Họ và tên*: </td>
		<td><s:textfield name="name" id="name" label="" /></td>
	</tr>
	<tr>
		<td>Tuổi*: </td>
		<td><s:textfield name="age" id="age" label="" maxlength="3" /></td>
	</tr>
	<tr>
		<td>Ngày khám*: </td>
		<td><s:textfield id="date" name="date" readonly="true" size="10" /></td>
	</tr>
	<tr>
		<td></td>
		<td>
			<div><img src="Captcha.jpg" border="0"></div>
		</td>
	</tr>
	<tr>
		<td>Nhập mã ở trên*: </td>
		<td><s:textfield label="Code" name="captcha" id="captcha" size="20" maxlength="10"/></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" value="Đăng kí"  /></td>
	</tr>
</table>
  
</s:form>
</div>
</body>
</html>